<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>コントロールパネル</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		
		<script type="text/javascript">
		$(function() {

			// メッセージのフェード
			$('.message').fadeIn("slow");
		});
		</script>
		<script type="text/javascript">
			function deleteAction(id){
				if(confirm("削除してもよろしいでしょうか?")){
					window.location.href='consumerInfo.php?consumer_id='+id+'&&mode=delete';
				}else{
					return false;
				}
			} 

			//更新
			function updateAction(){
				if(confirm('更新してよろしいですか？')){
					document.fm1.mode.type="submit";
				}else{
					return false;
				}
			} 

			function make_price(price_no){
				window.location.href='make_price.php?price_no='+price_no;
			}
			
			function openWin(u, w, h) { 
	            var l = (screen.width - w) / 2; 
	            var t = (screen.height - h) / 2; 
	            var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l; 
	            s += ', toolbar=no, scrollbars=yes, menubar=yes, location=no, resizable=yes'; 
	            open(u, 'oWin', s); 
	     	 } 
		</script>
	</head>
	<body id="">
{{ php }} include( MENU_FILE ); {{ /php }}
		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>
		
		<div id="container"><div class="wrapper">
			<h2>見積管理</h2>
			<ul class="submenu clearfix">
				<li><a href="consumer_index.php">顧客検索</a></li>								
				<li><a href="consumer_form.php">顧客登録</a></li>
				<li><a href="price_task.php">見積タスク一覧</a></li>
				<li><a href="price_check.php">見積検索</a></li>
				<li><a href="shop_index.php">商品マスタ</a></li>
			</ul>
			
			<h3>顧客参照</h3>	
			{{ if $phase == 'completedelete' }}
			<p class="message">正常に削除しました。</p>
			<ul>
				<li>&gt;&gt; <a href="consumer_index.php">一覧へ戻る</a></li>
			</ul>
			{{ else }}
			<!-- 
			<h4>顧客検索一覧</h4>
			<ul>							
				<li>＞ <a href="shop_index.php">製品マスタデータの検索</a></li>
				<li>＞ <a href="shop_form.php">製品マスタデータ登録</a></li>
				<li>＞ <a href="price_book.php">価格書</a></li>
				<li>＞ <a href="price_resolution.php">単価稟議書</a></li>
				<li>＞ <a href="consumer_price.php">顧客の価格リスト</a></li>
			</ul>	
			 -->
			<p class="message">参照結果</p>	

			<form name="fm1" action="consumerInfo.php" method="post">
				<table>
					<tr>
					<td style="width: 500px;">
					<ul type="square" style="background-color: black;width: 10px;height: 10px;float: left;margin-top: 6px"></ul>
					<h5>基本情報</h5>
					</td>
					<td>
					<p class="button" style="margin-top: -5px;overflow: visible;">
						<button type="button" name="mode" value="update" class="submit" onclick="window.location.href='consumer_form.php?consumer_id={{$list.consumer_id}}'"><span>更新</span></button>
						<button type="button" class="submit" onclick="deleteAction('{{$list.consumer_id}}')"><span>削除</span></button>
					</p>
					</td>
					</tr>
				</table>
				<table class="formTable">
					<tbody>
						
						<tr>
							<th>顧客ID</th>
							<td>{{$list.id}}</td>
						</tr>
						<tr>
							<th>登録日</th>
							<td>{{$list.r_date}}</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td>{{$list.u_date}}</td>
						</tr>
						<tr>
							<th>種别</th>
							<td>{{ if $list.category == '1' }}法人{{else}}個人{{/if}}</td>
						</tr>
						<tr>
							<th>会社名</th>
							<td>{{$list.company_name}}</td>
						</tr>

						<tr>
							<th>会社名（カタカナ）</th>
							<td>{{$list.katakana}}</td>
						</tr>

						<tr>
							<th>支店名</th>
							<td>{{$list.branch_name}}</td>
						</tr>

						<tr>
							<th>セールス担当者</th>
							<td>{{$list.sal_manager}}</td>
						</tr>

						<tr>
							<th>支払条件</th>
							<td>{{$list.payment_term}}</td>
						</tr>
					</tbody>
				</table>
				<input type="hidden" name="category" value="{{$list.category}}" />								
			</form><br/>
			<hr /><br/>
			
			<form name="fm" action="" method="post">				
			<table>
				<tr>
				<td style="width: 500px;">
				<ul type="square" style="background-color: black;width: 10px;height: 10px;float: left;margin-top: 6px"></ul>
				<h5>見積履歴</h5>
				</td>
				<td>
				<p class="button" style="margin-top: -2px;overflow: visible;">
					<button type="button" class="submit" onclick="javascript:window.location.href='make_price.php?consumer_id={{$list.consumer_id}}&mod=new'"><span>新規作成</span></button>
				</p>
				</td>
				</tr>
			</table>
			<table  class="formTable">
				<thead>
					<tr align="center">
						<th>見積NO.</th>
						<th>作成日</th>
						<th>更新日</th>
						<th>作成者</th>
						<th>承認者</th>
						<th>承認日</th>
						<th>客先同意</th>
						<th>見積書</th>
						<th>単価稟議書</th>
					</tr>

				</thead>
				<tbody>
{{ foreach from=$pricelist key=k item=v }}
					<tr>
						<td align="center">{{ $v.price_no }}</td>
						<td align="center">{{ $v.m_date }}</td>
						<td align="center">{{ $v.u_date }}</td>
						<td align="center">{{ $v.producer }}</td>
						<td align="center">{{ $staff[$v.examiner] }}</td>
						<td align="center">{{ $v.e_date }}</td>
						<td align="center">{{ $v.opt }}</td>
						<td align="center"><a href='javascript:openWin("price_book.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}",800,800)' >[見積書]</a></td>
						<td align="center"><a href='javascript:openWin("price_resolution.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}",800,800)'>[単価稟議書]</a></td>
					</tr>
{{ /foreach }}
				</tbody>
			</table>	
			<p align="center">
{{ if $page.current > 1 }}
				<a href="consumerinfo.php?page={{ $page.current-1 }}{{ $page.query }}">前の{{ $page.item }}件</a>&nbsp;&nbsp;
{{ /if }}
{{ foreach from=$page.paging key=k item=v }}
{{ if $v < $page.current+15 }}
{{ if $page.current == $v }}
{{ $v }}&nbsp;
{{ else }}
				<a href="consumerinfo.php?page={{ $v }}{{ $page.query }}">{{ $v }}</a>&nbsp;
{{ /if }}
{{ /if }}
{{ /foreach }}
{{ if $page.end > $page.current }}
				<a href="consumerinfo.php?page={{ $page.current+1 }}{{ $page.query }}">次の{{ $page.item }}件</a>
{{ /if }}
			</p>			
			</form>
{{ /if }}
		</div></div>
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>
	</body>

</html>